#pragma once
#include<renderpch.hpp>

struct VertexBufferElement
{
   unsigned int type;
   unsigned int count;
   bool normalized;

   static unsigned int GetSizeOfType(unsigned int type)
   {
      switch (type) {
         case GL_FLOAT:
         case GL_UNSIGNED_INT:
         return 4;
         break;
         case GL_UNSIGNED_BYTE:
         return 1;
         break;
      }
      return 0;
   }
};

enum GlLayoutType
{ 
    FLOAT,UNSIGNEDINT,UNSIGNEDCHAR
};

class VertexBufferLayout
{
   private:
    std::vector<VertexBufferElement>  myElements; 
    unsigned int myStride=0;
   public:
 
   void Push(unsigned int count,GlLayoutType type)  //count reflect how many attribut one element have.  type is float unsingedint unsigned char 
   {
    int myType=type;
     switch (myType) 
     {
       case 0:
      myElements.push_back({GL_FLOAT,count,false});
      myStride+=sizeof(GLfloat)*count;
      break;
       case 1:
      myElements.push_back({GL_UNSIGNED_INT,count,false});
      myStride+=sizeof(GLuint)*count;
      break;
       case 2:
      myElements.push_back({GL_UNSIGNED_BYTE,count,false});
      myStride+=sizeof(GLubyte)*count;
      break;
     }
   }
 
   inline auto GetElements(){ return myElements;}
   inline unsigned int GetStride() {return myStride;}

};